package ${rootPkg}.controller.${modelName};

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.bitkit.basic.container.ApiRequest;
import cn.bitkit.basic.container.ApiResponse;
import cn.bitkit.basic.container.PageRequest;
import cn.bitkit.basic.container.PageResponse;
import cn.bitkit.component.BizServiceExecutor;

import ${rootPkg}.pojo.dto.${modelName}.${entityVar}.*;

@RestController
@RequestMapping("/api")
public class ${entityName}Controller {

    @Autowired
    ServiceActuator serviceActuator;

    /** 分页查询 */
    @PostMapping("${entityVar}Page")
    public ApiResponse<PageResponse<${entityName}PageResp>> page(
            @RequestBody ApiRequest<PageRequest<${entityName}PageReq>> req){
        return serviceActuator.execute("${entityVar}Page", req);
    }

    /** 查询 */
    @PostMapping("${entityVar}Select")
    public ApiResponse<${entityName}SelectResp> select(
            @RequestBody ApiRequest<${entityName}SelectReq> req){
        return serviceActuator.execute("${entityVar}Select", req);
    }

    /** 新增 */
    @PostMapping("${entityVar}Add")
    public ApiResponse<${entityName}AddResp> add(
            @RequestBody ApiRequest<${entityName}AddReq> req){
        return serviceActuator.execute("${entityVar}Add", req);
    }

    /** 修改 */
    @PostMapping("${entityVar}Update")
    public ApiResponse<${entityName}UpdateResp> update(
            @RequestBody ApiRequest<${entityName}UpdateReq> req){
        return serviceActuator.execute("${entityVar}Update", req);
    }

}